<?php 
class exportPdfAction extends AdminMaster{
	public function execute($request){
		$action = $request->getParameter('action_name', '');
		$id = intval($request->getParameter('id', 0));
		
		$candidate = CandidatesTable::getDataById($id);
		$data = array();
		
		if($action == ADMIN_DEFINED::AJAX_PDF && count($candidate) > 0){
			$data['candidate']	= $candidate;
			$data['majors']		= MasterMajors::getArrayAllKeyId();
			$data['levels']		= MasterEducationLevels::getArrayAllKeyId();
			$data['job_positions']	= JobPositions::getArrayAllKeyId();
			$data['positions']	= CompanyPersonContactPositions::getArrayAllKeyId();
			$data['languages']	= MasterForeignLanguages::getArrayAllKeyId();
			$data['language_levels']	= MasterForeignLanguageLevels::getArrayAllKeyId();
			$data['technologies']	= MasterInformationTechnologies::getArrayAllKeyId();
			$data['technology_levels'] = MasterInformationTechnologyLevels::getArrayAllKeyId();
			$data['salaries']			= MasterSalaries::getArrayAllKeyId();
			
			$html = $this->getPartial('global/exportPdf',array('data' => $data));
			
			PdfHelper::export(array('content' => $html, 'file_name' => ($candidate['full_name']). '_'.DateHelper::dateFormat($candidate['date_of_birth'])));
			die;
		}else{
			echo __('hacking_attemp',null,'table_list');die;
		}
		$this->setVar('data', $data);
	}
}